var ser=window.location.search.substr(1)

$(document).on('ready pjax:end', function(event) {
  aczjbx_articledetail()
})


var demandfrom;
aczjbx_articledetail()
function aczjbx_articledetail(){
  $.ajaxSetup({async:false})

//localstoragerenewer()
$.getJSON("/articlelist/index.json",(data)=>{
    var indexlist=data["data"]
    document.getElementById("archiveCount").innerText=Object.getOwnPropertyNames(indexlist).length;
    console.log(indexlist)
        const articalorigin = indexlist[ser];
        $.getJSON(articalorigin["origin"],(data)=>{
          let questionContent
          if(data["data"].QuestionExist){
            $.get(data["data"].QuestionURL,(cont)=>{
              questionContent=cont
            })
          }
            $.get(data["data"].body,(body)=>{
                document.getElementById("_ress_title").innerText=data["data"].headline+" | 郑家宝のArticlePackage"
                document.getElementById("article_").innerHTML=`
                <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.jpg">
                <meta itemprop="name" content="Zhengjiabao">
                <meta itemprop="description" content="">
              </span>
          
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="郑家宝のArticlePackage">
              </span>
                <header class="post-header">
                  <h2 class="post-title" itemprop="name headline">
                  ${data["data"].headline}
                  </h2>
          
                  <div class="post-meta">
                      <span class="post-meta-item">
                        <span class="post-meta-item-icon">
                          <i class="fa fa-calendar-o"></i>
                        </span>
                        <span class="post-meta-item-text">发表于</span>
          
                        <time title="创建时间：${data["data"].datePublished} " itemprop="dateCreated datePublished" datetime="${data["data"].datePublishedtime}">${data["data"].datePublished}</time>
                      </span>
                        <span class="post-meta-item">
                          <span class="post-meta-item-icon">
                            <i class="fa fa-calendar-check-o"></i>
                          </span>
                          <span class="post-meta-item-text">更新于</span>
                          <time title="修改时间：${data["data"].dateModified}" itemprop="dateModified" datetime="${data["data"].dateModifiedtime}">${data["data"].dateModified}</time>
                        </span>
          
                
          
                  </div>
                </header>
          

                <a href="/articleViewHandwriting/?${data["data"].hash}"
                class="use-motion" style="${data["data"].handwrittenexist?"display: block;":"display:none;"}text-align: center;background-color: bisque;border-radius: 100px;margin: 10px;padding: 10px;font-size: 1.125em;">阅读手写稿</a>
              
                <a href="/articledetail/?${data["data"].ModifiedFrom}"
                class="use-motion" style="${data["data"].ModifiedVersion?"display: block;":"display:none;"}text-align: center;background-color: bisque;border-radius: 100px;margin: 10px;padding: 10px;font-size: 1.125em;">素材改自一个已有的材料,阅读原材料</a>
              

                <div
                class="use-motion" style="${data["data"].fictionmaterial?"display: block;":"display:none;"}text-align: left;
                background-color: aqua;
                border-radius: 10px;
                margin: 10px;
                padding: 10px;
                font-size: 1em;
                line-height: 28px;
                letter-spacing: 0em;
                font-weight: 700;">创作声明:本文素材系虚构</div>
              
              
              <div class="post-body" itemprop="articleBody">
              <div style="border-top-width: 1px;border-top-style: dotted;border-left-width: 1px;border-left-style: dotted;border-right-width: 1px;border-right-style: dotted;border-bottom-width: 1px;border-bottom-style: dotted;
              border-radius: 10px;background-color: rgba(240, 248, 255,0.6);padding-left: 50px;padding-top: 10px;padding-bottom: 10px;padding-right: 50px;
              letter-spacing: 0.05em;font-weight: 500;${data["data"].QuestionExist?"display: block;":"display:none;"}
              ">
              <span style="font-family: 'Lato', 'PingFang SC', 'Microsoft YaHei', sans-serif;">题目：</span>
              ${data["data"].QuestionExist?questionContent:""}
              </div>
                <p>
              ${body.replaceAll("\\n","<p/><p>")}
                </p>
              </div>
          
              <a href="${data["data"].originwordexist?data["data"].originwordURL:""}"
                class="use-motion" style="${data["data"].originwordexist?"display: block;":"display:none;"}text-align: center;background-color: bisque;border-radius: 100px;margin: 10px;padding: 10px;font-size: 1.125em;">下载此文档</a>
              
              
              
          
              <div>
                
                  <div>
              
                  <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
              
          </div>
                
              </div>
                  
          
          <div>
          <ul class="post-copyright">
            <li class="post-copyright-author">
              <strong>本文作者： </strong>郑家宝
            </li>
            <li class="post-copyright-link">
              <strong>本文链接：</strong>
              <a href="${window.location.href}" title="${data["data"].headline}">${window.location.href}</a>
            </li>
            <li class="post-copyright-license">
              <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
            </li>
          </ul>
          </div>
          
          
                <footer class="post-footer">

                </footer>
                `
            })

        })
})
$.ajaxSetup({async:true})
}
